import { constantRoutes } from "@/router";
const state = {
  // 异步和公共
  routes: [...constantRoutes],
};
const mutations = {
  setRoutes(state, routes) {
    state.routes = [...constantRoutes, ...routes];
  },
};
const actions = {
  // 筛选有权限的路由
  // filterRoutes({ commit }, menus) {
  //   const menuNames = menus.map((menu) => menu.name);
  //   const routes = asyncRouterMap.filter((item) =>
  //     menuNames.includes(item.name),
  //   );
  //   console.log("vuex当中筛选权限", routes);
  //   commit("setRoutes", routes);
  //   return routes;
  // },
};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
